package com.robot.bean;

import java.util.ArrayList;
import java.util.List;

public class Reply {
	private String question;
	private List<String> answer = new ArrayList<String>();
	private long lastAnswerTime;
	private int index;
	public String getAnswer() {
		long nowTime = System.currentTimeMillis();
		if(nowTime-lastAnswerTime>300000){
			index = 0;
		}else{
			index++;
		}
		if(index>=answer.size()){
			index = answer.size()-1;
		}
		this.lastAnswerTime = nowTime;
		return answer.get(index);
	}
	public void setAnswer(String answer) {
		if(answer!=null&&!answer.equals("")){
			this.answer.add(answer);
		}
	}
	
	public String getQuestion() {
		return question;
	}
	public void setQuestion(String question) {
		this.question = question;
	}
	public long getLastAnswerTime() {
		return lastAnswerTime;
	}
	public void setLastAnswerTime(long lastAnswerTime) {
		this.lastAnswerTime = lastAnswerTime;
	}
	public int getIndex() {
		return index;
	}
	public void setIndex(int index) {
		this.index = index;
	}
	@Override
	public String toString() {
		return "Reply [question=" + question + ", answer=" + answer + "]";
	}
	
}
